<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title><?=getValInArr(getSess(SESS_DIC),array('webInfo','webtitle'))?></title>
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>
    <meta content="yes" name="apple-mobile-web-app-capable"/>
    <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
    <meta content="telephone=no" name="format-detection"/>
    <script src="<?php echo base_url().'public/home/js/' ?>jquery.js"></script>
    <?php 
    include_once "public/home/html/alert.php" ;
    ?>
    <script type="text/javascript" src="<?php echo base_url().'public/home/js/' ?>function.js"></script>
    <?php include_once "public/home/html/broadcast.php"  ?>
    <link rel="stylesheet" href="<?php echo base_url().'public/home/css/' ?>index.css">
    <?php include_once "public/home/html/bootstrap.php"  ?>
    <style>
        .panel-default{
            margin:20px;
        }
        .form-control[readonly]{
            background: white;
        }
        .button{
            text-align: center;
            margin-top: 20px;
        }
        button{
            width: 200px;
            margin-top: 20px;
        }
    </style>
</head>
<body>
    <input type="hidden" name="url" id="url"value="<?php echo base_url()?>">
    <div class="panel panel-default">
        <div class="panel-heading">搜索</div>
        <div class="panel-body">
            <form role="form" id="searchForm" class="form-inline">
                <div class="form-group">
                    <label for="sname1">课程名称</label>
                    <input type="text" class="form-control" id="class_name" name="sname1" placeholder="请输入课程名称" readonly data-type="<?=SearchType::First[XPHEnum::Value]?>"onclick="gotoSearch(this)" value="<?php if(isset($class_name))echo $class_name?>" data-id="<?php if(isset($class_id))echo $class_id?>">
                    <input value="<?php if(isset($class_id))echo $class_id?>" id="class_id" type="hidden">
                </div>
                <div class="form-group">
                    <label for="sname1">教师名称</label>
                    <input type="text" class="form-control" id="teacher_name" name="sname1" placeholder="请输入教师名称" readonly data-type="<?=SearchType::Second[XPHEnum::Value]?>"onclick="gotoSearch(this)" value="<?php if(isset($teacher_name))echo $teacher_name?>" data-id="<?php if(isset($teacher_id))echo $teacher_id?>">
                    <input value="<?php if(isset($teacher_id))echo $teacher_id?>"id="teacher_id"  type="hidden">
                </div>                
            </form>
        </div>
    </div>

    <div class="button">
        <button type="button" class="btn btn-primary btn-lg " onclick="gotoAssess()">听课</button>
    </div>

    <script>
        function gotoSearch(obj){
            var teacher_name=encodeURI($("#teacher_name").val());
            var class_name=encodeURI($("#class_name").val());
            var teacher_id=encodeURI($("#teacher_id").val());
            var class_id=encodeURI($("#class_id").val());
            var href=getRootPath()+'/Home/Search/Index/'+$(obj).attr('data-type')+'?';
            // if(teacher_name!=''){
            //     href+='teacher_name='+teacher_name;
            // }
            // if(class_name!=''){
            //     if(teacher_name==''){
            //         href+='class_name='+class_name;
            //     }else{
            //         href+='&class_name='+class_name;
            //     }
            // }
           location.href=href+"class_name="+class_name+'&class_id='+class_id+'&teacher_name='+teacher_name+'&teacher_id='+teacher_id;
        }
        function gotoAssess(){            
            var teacher_id=encodeURI($("#teacher_id").val());
            var class_name=encodeURI($("#class_id").val());
            // if(teacher_id==''){
            //     jqueryAlert({
            //         'icon': $('input[name="url"]').val() + 'public/home/alert/img/error.png',
            //         'content': '请输入教师姓名',
            //         'closeTime': 1000,
            //     })
            //     return;
            // }
            // if(class_name==''){
            //     jqueryAlert({
            //         'icon': $('input[name="url"]').val() + 'public/home/alert/img/error.png',
            //         'content': '请输入课程名称',
            //         'closeTime': 1000,
            //     })
            //     return;
            // }
            window.location.href=$("input[name='url']").val()+"Home/Class_Assess/Index/0/"+teacher_id+"/"+class_name;
        }
        
     </script>

 </body>
 </html>
